package com.yc.mvc.web;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;

@Data
public class User {

    @NotEmpty(message = "姓名不能为空")
    @Length(min=2, max = 20, message = "姓名长度必须是 2~20 个字符")
    private String name;
    @NotEmpty
    @Length(min = 6, max = 16)
    @Pattern(regexp = "[0-9a-zA-Z]+", message = "密码必须是由字母或者数字构成")
    private String pwd;
    @Min(18)
    @Max(80)
    private int age;
    @Email(message = "邮箱地址不正确")
    private String email;
    @Pattern(regexp = "1\\d{10}", message = "手机号码格式不正确")
    private String phone;
}
